<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function $(id){
            return document.getElementById(id);
        }

        window.onload=function(){
            var mydiv=$("mydiv");
            var myp=$("myp");
        };
    </script>
</head>
<body>
    <div id="mydiv">mydiv</div>
    <p id="myp">myp </p>
</body>
</html>